package com.pkk.penguin.frame.know.java.jvm.classload;


/**
 * @description: 获取classLoader的几种方式
 * @author: peikunkun
 * @create: 2020-02-20 14:48
 **/
public class GetClassLoader {

  public static void main(String[] args) throws ClassNotFoundException {

    System.out.println("获取当前类的加载器:");
    System.out
        .println(Class.forName("com.pkk.penguin.frame.know.java.jvm.classload.GetClassLoader").getClassLoader());
    System.out.println("获取当前线程的加载器:");
    System.out.println(Thread.currentThread().getContextClassLoader());
    System.out.println("获取系统的加载器:");
    System.out.println(ClassLoader.getSystemClassLoader());
    //System.out.println("获取指定类调用者的加载器:(涉及到本地方法的调用)");
    //System.out.println(DriverManager.getCallerClassLoader);

  }

}
